//@charset "utf-8"
var condition = {
	ToCDB: function (str) {
		var tmp = "";
		for (var i = 0; i < str.length; i++) {
			if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
				tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
			} else {
				tmp += String.fromCharCode(str.charCodeAt(i));
			}
		}
		return tmp
	},
	getMarket : async function (code, name) {
		var self = this;
		var thsPassport = new ThsPassport();

		var codeMarketStr = await thsPassport.getAllStockInfo(code);
		var codeMarketObj = eval('('+ codeMarketStr +')');

		var codeMarket = '';
		var codeNameArr = [];

		$.each(codeMarketObj, function (i, val) {
			var _name = self.ToCDB(val.codeName);
			if (name.replace(/\s/g, '') == _name.replace(/\s/g, '')) {
				codeMarket = val.market;
			}
			codeNameArr.push(val.codeName);
		});
		var rst;
		return rst = codeMarket + ':' + code;
	},
	bindEvent : async function () {
		var self = this;
		$("#view_stock_input").focus(function(){
			this.select();
			$('.tip-stock').show();
			//weiNull();
		});
		$("#view_stock_input").keyup(function(event){
			weiNull();
		});
		$("#view_stock_input").blur(function () {
			var _this = this;
			setTimeout(async function(){
				var stockStr = $(_this).val();
				var stockArr = stockStr.split(" ");
				var stock = stockArr[0].replace(/\s/g, '');
				var Jpjl1 = new JpjlModel("#view_stock_input", '', 5, '', '');
				var getInputCodeData = Jpjl1.getInputCodeData(stock);
				if(getInputCodeData != null){
					var currentstock = getInputCodeData.stock || '';
					
					var name = stockArr[1].replace(/\s/g, '') || getInputCodeData.name || '';
					// if(currentstock != stock){
						var mStock = await self.getMarket(currentstock, name);
						var market = mStock.split(':')[0];
						$("#view_stock_input").attr('data-market', market);
						await hqQuote.request(condition.render, mStock, 'now', currentstock);
						$("#view_stock_input").val(currentstock);
					// }
					if (stock != $("#hiddenNowStock").val()) {
						$("#hiddenNowStock").val('');
					}
					$('.tip-stock').hide();
				}else{
					var code = getUrlParam('code');
					var market = getUrlParam('market');
					await hqQuote.request(condition.render, market+':'+code, 'now', code);
					$("#view_stock_input").val(code);
				}
			}, 50);
		});

		//点击 更多展开收起
		/*$("#view_show_more").click(function () {
			$("#view_div_condition_more").show();
			$("#view_show_more").hide();
			$("#view_hide_more").show();
			TaNumber.viewShowMore();
			var clientInterface = new ComClientInterface();
    		clientInterface.modifyWindowsSizeL('442','473','');

		});

		$("#view_hide_more").click(function () {
			$("#view_div_condition_more").hide();
			$("#view_hide_more").hide();
			$("#view_show_more").show();
			TaNumber.viewHideMore();
			var clientInterface = new ComClientInterface();
    		clientInterface.modifyWindowsSizeL('442','367','');
		});*/

		/*点击其他条件*/
		$("#other-term").click(async function(){
			var stockStr = $("#view_stock_input").val();
			var stockArr = stockStr.split(" ");
			var stockcode = stockArr[0].replace(/\s/g, '');
			var market = $('#view_stock_input').attr('data-market');
			var clientInterface = new ComClientInterface();
			await clientInterface.openotherAlert(stockcode, market);
			TaNumber.otherTerm();
		});

		/*预警方式弹出*/
		$("#w-method").click(async function(){
			//获取一次提醒方式todo
			$(".s-box").show();
			$(".mask").show();
			//$(".s-box").css("top","80px");
			TaNumber.wMethod();
			var clientInterface = new ComClientInterface();
			var modestr = await clientInterface.getDefaultAlertMode();
			
			if(modestr != ''){
				// alert(modestr);
				var arrmode_m = modestr.split(",");

				if(arrmode_m[0] == 1){
		            $("#keep_monitor").addClass("c-on");
		        }else{
		            $("#keep_monitor").removeClass("c-on");
		        }
		        if(arrmode_m[1] == 1){
		            $("#show_pop").addClass("c-on");
		        }else{
		            $("#show_pop").removeClass("c-on");
		        }
		        if(arrmode_m[5] == 1){
		            $("#keep_iphone").addClass("c-on");
		        }else{
		            $("#keep_iphone").removeClass("c-on");
		        }
		        if(arrmode_m[6] == 1){
		            $("#call_auction").addClass("c-on");
		        }else{
		            $("#call_auction").removeClass("c-on");
		        }
		        if(arrmode_m[2] == 1){
		            if(arrmode_m[4] == 'alert'){
		                $("#soundid").find('[value="alert"]').get(0).selected = true;
		            }else if(arrmode_m[4] == 'up'){
		                $("#soundid").find('[value="up"]').get(0).selected = true;
		            }else if(arrmode_m[4] == '清脆'){
		                $("#soundid").find('[value="清脆"]').get(0).selected = true;
		            }
		        }else{
		            $("#show_sounds").removeClass("c-on");
		            $("#soundid").hide();

		        }

			}
		});

		//上涨到list
		var LpriceUpInputWrong = new InputWrong(
			$(".view_price_up_input"),
			$(".view_price_up_msg"),
			$(".view_price_up")
		);
		LpriceUpInputWrong.bindEvent();
		LpriceUpInputWrong.valid = LpriceUpInputWrong.max = function () {
			$(".view_price_up_msg").css("color", "#333");
			var curPrice = $("#newP").html();
			var inputPrice = $(".view_price_up_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$(".view_price_up_input").val(inputPrice+'0');
			}
			inputPrice = $(".view_price_up_input").val();
			var jz = parseFloat(inputPrice)-parseFloat(curPrice);
			var zhangfu = parseFloat(jz/curPrice*100).toFixed(2);
			if(zhangfu == 'NaN'){
				var successText = "涨幅为--";
			}else{
				var successText = "涨幅为" + mCutStr(zhangfu,6,'.') + "%";
			}
			$(".view_price_up_msg").attr('view_valid_msg', successText);
			$(".view_price_up_msg").html(successText);

		};
		//上涨到
		var priceUpInputWrong = new InputWrong(
			$("#view_price_up_input"),
			$("#view_price_up_msg"),
			$("#view_price_up")
		);
		priceUpInputWrong.bindEvent();
		priceUpInputWrong.valid = priceUpInputWrong.max = function () {
			$("#view_price_up_msg").css("color", "#333");
			var curPrice = $("#view_stock_curprice").html();
			var inputPrice = $("#view_price_up_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$("#view_price_up_input").val(inputPrice+'0');
			}
			inputPrice = $("#view_price_up_input").val();
			var jz = parseFloat(inputPrice)-parseFloat(curPrice);
			var zhangfu = parseFloat(jz/curPrice*100).toFixed(2);
			if(zhangfu == 'NaN'){
				var successText = "涨幅为--";
			}else{
				var successText = "涨幅为" + mCutStr(zhangfu,16,'..') + "%";
			}
			$("#view_price_up_msg").attr('view_valid_msg', successText);
			$("#view_price_up_msg").html(successText);
			$("#view_price_up_input").attr("upmove","1");
		};
		//下跌到list
		var LpriceDownInputWrong = new InputWrong(
			$(".view_price_down_input"),
			$(".view_price_down_msg"),
			$(".view_price_down")
		);
		LpriceDownInputWrong.bindEvent();
		LpriceDownInputWrong.valid = LpriceDownInputWrong.less = function () {
			$(".view_price_down_msg").css("color", "#333");
			var curPrice = $("#newP").html();
			var inputPrice = $(".view_price_down_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$(".view_price_down_input").val(inputPrice+'0');
			}
			inputPrice = $(".view_price_down_input").val();
			var jz = parseFloat(curPrice)-parseFloat(inputPrice);
			var diefu = parseFloat(jz/curPrice*100).toFixed(2);
			if(diefu == 'NaN'){
				var successText = "跌幅为--";
			}else{
				var successText = "跌幅为" + mCutStr(diefu,16,'..') + "%";
			}
			$(".view_price_down_msg").attr('view_valid_msg', successText);
			$(".view_price_down_msg").html(successText);
		};
		//下跌到
		var priceDownInputWrong = new InputWrong(
			$("#view_price_down_input"),
			$("#view_price_down_msg"),
			$("#view_price_down")
		);
		priceDownInputWrong.bindEvent();
		priceDownInputWrong.valid = priceDownInputWrong.less = function () {
			$("#view_price_down_msg").css("color", "#333");
			var curPrice = $("#view_stock_curprice").html();
			var inputPrice = $("#view_price_down_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$("#view_price_down_input").val(inputPrice+'0');
			}
			inputPrice = $("#view_price_down_input").val();
			var jz = parseFloat(curPrice)-parseFloat(inputPrice);
			var diefu = parseFloat(jz/curPrice*100).toFixed(2);
			if(diefu == 'NaN'){
				var successText = "跌幅为--";
			}else{
				var successText = "跌幅为" + mCutStr(diefu,16,'..') + "%";
			}
			$("#view_price_down_msg").attr('view_valid_msg', successText);
			$("#view_price_down_msg").html(successText);
			$("#view_price_down_input").attr("upmove","1");
		};
		//日涨幅list
		var LpriceDayInputWrong = new InputWrong(
			$(".view_day_zhangfu_input"),
			$(".view_day_zhangfu_msg"),
			$(".view_day_zhangfu")
		);
		LpriceDayInputWrong.bindEvent();
		LpriceDayInputWrong.valid = LpriceDayInputWrong.less = function () {
			$(".view_day_zhangfu_msg").css("color", "#333");
			var curPrice = parseFloat($("#newP").attr('pres'));


			var inputPrice = $(".view_day_zhangfu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$(".view_day_zhangfu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($(".view_day_zhangfu_input").val());

			var upPrice = (parseFloat(curPrice) + parseFloat(curPrice*(inputPrice/100))).toFixed(2);

			if(upPrice == 'NaN'){
				var successText = "股价大于--";
			}else{
				var successText = "股价大于" + mCutStr(upPrice,5,'..');
			}
			$(".view_day_zhangfu_msg").attr('view_valid_msg', successText);
			$(".view_day_zhangfu_msg").html(successText);
			if(inputPrice == 0){
				$(".view_day_zhangfu_msg").css("color", "#b80c0c");
				$(".view_day_zhangfu_msg").html("输入无效！");
				$(".view_day_zhangfu_msg").attr('view_valid_msg', '');
				$(".view_day_zhangfu_msg").attr('view_empty_msg', '输入无效！');
			}
		};
		//日涨幅
		var priceDayInputWrong = new InputWrong(
			$("#view_day_zhangfu_input"),
			$("#view_day_zhangfu_msg"),
			$("#view_day_zhangfu")
		);
		priceDayInputWrong.bindEvent();
		priceDayInputWrong.valid = priceDayInputWrong.less = function () {
			$("#view_day_zhangfu_msg").css("color", "#333");
			var curPrice = parseFloat($("#view_stock_curprice").attr('pres'));

			var inputPrice = $("#view_day_zhangfu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$("#view_day_zhangfu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($("#view_day_zhangfu_input").val());

			var upPrice = (parseFloat(curPrice) + parseFloat(curPrice*(inputPrice/100))).toFixed(2);

			if(upPrice == 'NaN'){
				var successText = "股价大于--";
			}else{
				var successText = "股价大于" + mCutStr(upPrice,5,'..');
			}
			$("#view_day_zhangfu_msg").attr('view_valid_msg', successText);
			$("#view_day_zhangfu_msg").html(successText);
			if(inputPrice == 0){
				$("#view_day_zhangfu_msg").css("color", "#b80c0c");
				$("#view_day_zhangfu_msg").html("日涨幅输入无效！");
				$("#view_day_zhangfu_msg").attr('view_valid_msg', '');
				$("#view_day_zhangfu_msg").attr('view_empty_msg', '日涨幅输入无效！');
			}
			$("#view_day_zhangfu_input").attr("upmove","1");
		};
		//日跌幅list
		var LpriceDaydInputWrong = new InputWrong(
			$(".view_day_diefu_input"),
			$(".view_day_diefu_msg"),
			$(".view_day_diefu")
		);
		LpriceDaydInputWrong.bindEvent();
		LpriceDaydInputWrong.valid = LpriceDayInputWrong.less = function () {
			$(".view_day_diefu_msg").css("color", "#333");
			var curPrice = parseFloat($("#newP").attr('pres'));

			var inputPrice = $(".view_day_diefu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$(".view_day_diefu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($(".view_day_diefu_input").val());

			var dowPrice = (parseFloat(curPrice) - parseFloat(curPrice*(inputPrice/100))).toFixed(2);
			if(dowPrice == 'NaN'){
				var successText = "股价小于--";
			}else{
				var successText = "股价小于" + mCutStr(dowPrice,5,'..');
			}
			$(".view_day_diefu_msg").attr('view_valid_msg', successText);
			$(".view_day_diefu_msg").html(successText);
			if(inputPrice == 0){
				$(".view_day_diefu_msg").css("color", "#b80c0c");
				$(".view_day_diefu_msg").html("输入无效！");
				$(".view_day_diefu_msg").attr('view_valid_msg', '');
				$(".view_day_diefu_msg").attr('view_empty_msg', '输入无效！');
			}
		};
		//日跌幅
		var priceDaydInputWrong = new InputWrong(
			$("#view_day_diefu_input"),
			$("#view_day_diefu_msg"),
			$("#view_day_diefu")
		);
		priceDaydInputWrong.bindEvent();
		priceDaydInputWrong.valid = priceDayInputWrong.less = function () {
			$("#view_day_diefu_msg").css("color", "#333");
			var curPrice = parseFloat($("#view_stock_curprice").attr('pres'));
			var inputPrice = $("#view_day_diefu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$("#view_day_diefu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($("#view_day_diefu_input").val());

			var dowPrice = (parseFloat(curPrice) - parseFloat(curPrice*(inputPrice/100))).toFixed(2);
			if(dowPrice == 'NaN'){
				var successText = "股价小于--";
			}else{
				var successText = "股价小于" + mCutStr(dowPrice,5,'..');
			}
			$("#view_day_diefu_msg").attr('view_valid_msg', successText);
			$("#view_day_diefu_msg").html(successText);
			if(inputPrice == 0){
				$("#view_day_diefu_msg").css("color", "#b80c0c");
				$("#view_day_diefu_msg").html("日跌幅输入无效！");
				$("#view_day_diefu_msg").attr('view_valid_msg', '');
				$("#view_day_diefu_msg").attr('view_empty_msg', '日跌幅输入无效！');
			}
			$("#view_day_diefu_input").attr("upmove","1");
		};
		//5分钟涨幅list
		var LpricefiveminInputWrong = new InputWrong(
			$(".view_fivemin_zhangfu_input"),
			$(".view_fivemin_zhangfu_msg"),
			$(".view_fivemin_zhangfu")
		);
		LpricefiveminInputWrong.bindEvent();
		LpricefiveminInputWrong.valid = LpricefiveminInputWrong.less = function () {
			$(".view_fivemin_zhangfu_msg").css("color", "#333");
			var curPrice = parseFloat($("#newP").html());

			var inputPrice = $(".view_fivemin_zhangfu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$(".view_fivemin_zhangfu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($(".view_fivemin_zhangfu_input").val());

			var upPrice = (parseFloat(curPrice) + parseFloat(curPrice*(inputPrice/100))).toFixed(2);
			if(upPrice == 'NaN'){
				var successText = "股价大于--";
			}else{
				var successText = "股价大于" + mCutStr(upPrice,5,'..');
			}
			$(".view_fivemin_zhangfu_msg").attr('view_valid_msg', '');
			$(".view_fivemin_zhangfu_msg").html('');
			if(inputPrice == 0){
				$(".view_fivemin_zhangfu_msg").css("color", "#b80c0c");
				$(".view_fivemin_zhangfu_msg").html("输入无效！");
				$(".view_fivemin_zhangfu_msg").attr('view_valid_msg', '');
				$(".view_fivemin_zhangfu_msg").attr('view_empty_msg', '输入无效！');
			}
		};
		//5分钟涨幅
		var pricefiveminInputWrong = new InputWrong(
			$("#view_fivemin_zhangfu_input"),
			$("#view_fivemin_zhangfu_msg"),
			$("#view_fivemin_zhangfu")
		);
		pricefiveminInputWrong.bindEvent();
		pricefiveminInputWrong.valid = pricefiveminInputWrong.less = function () {
			$("#view_fivemin_zhangfu_msg").css("color", "#333");
			var curPrice = parseFloat($("#view_stock_curprice").html());
			var inputPrice = $("#view_fivemin_zhangfu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$("#view_fivemin_zhangfu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($("#view_fivemin_zhangfu_input").val());

			var upPrice = (parseFloat(curPrice) + parseFloat(curPrice*(inputPrice/100))).toFixed(2);
			if(upPrice == 'NaN'){
				var successText = "股价大于--";
			}else{
				var successText = "股价大于" + mCutStr(upPrice,5,'..');
			}
			$("#view_fivemin_zhangfu_msg").attr('view_valid_msg', '');
			$("#view_fivemin_zhangfu_msg").html('');
			if(inputPrice == 0){
				$("#view_fivemin_zhangfu_msg").css("color", "#b80c0c");
				$("#view_fivemin_zhangfu_msg").html("5分钟涨幅输入无效！");
				$("#view_fivemin_zhangfu_msg").attr('view_valid_msg', '');
				$("#view_fivemin_zhangfu_msg").attr('view_empty_msg', '5分钟涨幅输入无效！');
			}
			$("#view_fivemin_zhangfu_input").attr("upmove","1");
		};
		//5分钟跌幅list
		var LpricefiveminInputWrong = new InputWrong(
			$(".view_fivemin_diefu_input"),
			$(".view_fivemin_diefu_msg"),
			$(".view_fivemin_diefu")
		);
		LpricefiveminInputWrong.bindEvent();
		LpricefiveminInputWrong.valid = LpricefiveminInputWrong.less = function () {
			$(".view_fivemin_diefu_msg").css("color", "#333");
			var curPrice = parseFloat($("#newP").html());
			var inputPrice = $(".view_fivemin_diefu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$(".view_fivemin_diefu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($(".view_fivemin_diefu_input").val());

			var dowPrice = (parseFloat(curPrice) - parseFloat(curPrice*(inputPrice/100))).toFixed(2);
			if(dowPrice == 'NaN'){
				var successText = "股价小于--";
			}else{
				var successText = "股价小于" + mCutStr(dowPrice,5,'..');
			}
			$(".view_fivemin_diefu_msg").attr('view_valid_msg', '');
			$(".view_fivemin_diefu_msg").html('');
			if(inputPrice == 0){
				$(".view_fivemin_diefu_msg").css("color", "#b80c0c");
				$(".view_fivemin_diefu_msg").html("输入无效！");
				$(".view_fivemin_diefu_msg").attr('view_valid_msg', '');
				$(".view_fivemin_diefu_msg").attr('view_empty_msg', '输入无效！');
			}
		};
		//5分钟跌幅
		var pricefiveminInputWrong = new InputWrong(
			$("#view_fivemin_diefu_input"),
			$("#view_fivemin_diefu_msg"),
			$("#view_fivemin_diefu")
		);
		pricefiveminInputWrong.bindEvent();
		pricefiveminInputWrong.valid = pricefiveminInputWrong.less = function () {
			$("#view_fivemin_diefu_msg").css("color", "#333");
			var curPrice = parseFloat($("#view_stock_curprice").html());
			var inputPrice = $("#view_fivemin_diefu_input").val();
			var sss = inputPrice.substr(inputPrice.length-1,1);
			if(sss == '.'){
				$("#view_fivemin_diefu_input").val(inputPrice+'0');
			}
			inputPrice = parseFloat($("#view_fivemin_diefu_input").val());

			var dowPrice = (parseFloat(curPrice) - parseFloat(curPrice*(inputPrice/100))).toFixed(2);
			if(dowPrice == 'NaN'){
				var successText = "股价小于--";
			}else{
				var successText = "股价小于" + mCutStr(dowPrice,5,'..');
			}
			$("#view_fivemin_diefu_msg").attr('view_valid_msg', '');
			$("#view_fivemin_diefu_msg").html('');
			if(inputPrice == 0){
				$("#view_fivemin_diefu_msg").css("color", "#b80c0c");
				$("#view_fivemin_diefu_msg").html("5分钟跌幅输入无效！");
				$("#view_fivemin_diefu_msg").attr('view_valid_msg', '');
				$("#view_fivemin_diefu_msg").attr('view_empty_msg', '5分钟跌幅输入无效！');
			}
			$("#view_fivemin_diefu_input").attr("upmove","1");
		};
		//5公告
		var gonggaoWrong = new InputWrong(
			$("#view_gonggao_input"),
			$("#view_gonggao_msg"),
			$("#view_gonggao")
		);
		gonggaoWrong.bindEvent();
		//换手率list
		var LpriceHuanshoulvInputWrong = new InputWrong(
			$(".view_huanshoulv_input"),
			$(".view_huanshoulv_msg"),
			$(".view_huanshoulv")
		);
		LpriceHuanshoulvInputWrong.bindEvent();
		LpriceHuanshoulvInputWrong.valid = LpriceHuanshoulvInputWrong.less = function () {
			var inputPrice = parseFloat($(".view_huanshoulv_input").val());
			$(".view_huanshoulv_msg").html("");
			$(".view_huanshoulv_msg").attr('view_valid_msg', '');
			if(inputPrice == 0){
				$(".view_huanshoulv_msg").css("color", "#b80c0c");
				$(".view_huanshoulv_msg").html("输入无效！");
				$(".view_huanshoulv_msg").attr('view_valid_msg', '');
				$(".view_huanshoulv_msg").attr('view_empty_msg', '输入无效！');
			}
		};
		//换手率
		var priceHuanshoulvInputWrong = new InputWrong(
			$("#view_huanshoulv_input"),
			$("#view_huanshoulv_msg"),
			$("#view_huanshoulv")
		);
		priceHuanshoulvInputWrong.bindEvent();
		priceHuanshoulvInputWrong.valid = priceHuanshoulvInputWrong.less = function () {
			var inputPrice = parseFloat($("#view_huanshoulv_input").val());
			$("#view_huanshoulv_msg").html("");
			$("#view_huanshoulv_msg").attr('view_valid_msg', '');
			if(inputPrice == 0){
				$("#view_huanshoulv_msg").css("color", "#b80c0c");
				$("#view_huanshoulv_msg").html("换手率输入无效！");
				$("#view_huanshoulv_msg").attr('view_valid_msg', '');
				$("#view_huanshoulv_msg").attr('view_empty_msg', '换手率输入无效！');
			}
			$("#view_huanshoulv_input").attr("upmove","1");
		};
		//单笔成交量list
		var LpricechengjiaoliangInputWrong = new InputWrong(
			$(".view_one_chengjiaoliang_input"),
			$(".view_one_chengjiaoliang_msg"),
			$(".view_one_chengjiaoliang")
		);
		LpricechengjiaoliangInputWrong.bindEvent();
		LpricechengjiaoliangInputWrong.valid = LpricechengjiaoliangInputWrong.max = function () {
			var inputPrice = parseFloat($(".view_one_chengjiaoliang_input").val());
			$(".view_one_chengjiaoliang_msg").html("");
			$(".view_one_chengjiaoliang_msg").attr('view_valid_msg', '');
			if(inputPrice == 0){
				$(".view_one_chengjiaoliang_msg").css("color", "#b80c0c");
				$(".view_one_chengjiaoliang_msg").html("输入无效！");
				$(".view_one_chengjiaoliang_msg").attr('view_valid_msg', '');
				$(".view_one_chengjiaoliang_msg").attr('view_empty_msg', '输入无效！');
			}
		};
		//单笔成交量
		var pricechengjiaoliangInputWrong = new InputWrong(
			$("#view_one_chengjiaoliang_input"),
			$("#view_one_chengjiaoliang_msg"),
			$("#view_one_chengjiaoliang")
		);
		pricechengjiaoliangInputWrong.bindEvent();
		pricechengjiaoliangInputWrong.valid = pricechengjiaoliangInputWrong.max = function () {
			var inputPrice = parseFloat($("#view_one_chengjiaoliang_input").val());
			$("#view_one_chengjiaoliang_msg").html("");
			$("#view_one_chengjiaoliang_msg").attr('view_valid_msg', '');
			if(inputPrice == 0){
				$("#view_one_chengjiaoliang_msg").css("color", "#b80c0c");
				$("#view_one_chengjiaoliang_msg").html("成交量输入无效！");
				$("#view_one_chengjiaoliang_msg").attr('view_valid_msg', '');
				$("#view_one_chengjiaoliang_msg").attr('view_empty_msg', '成交量输入无效！');
			}
			$("#view_one_chengjiaoliang_input").attr("upmove","1");
		};
		//自选股
		/*var zixuanguWrong = new InputWrong(
			$("#view_zixuangu_input"),
			$("#view_zixuangu_msg"),
			$("#view_zixuangu")
		);
		zixuanguWrong.bindEvent();*/
		//保持监控
		var keepMonitorWrong = new InputWrong(
			$("#monitor_input"),
			$("#monitor_msg"),
			$("#keep_monitor")

		);
		keepMonitorWrong.bindEvent();
		//弹出框
		var showPopWrong = new InputWrong(
			$("#showpop_inpnt"),
			$("#showppo_msg"),
			$("#show_pop")
		);

		showPopWrong.bindEvent();
		//集合竞价
		var callAuction = new InputWrong(
			$('#call_auction_input'),
			$('#call_auction_msg'),
			$('#call_auction')
		);
		callAuction.bindEvent();

		//警报
		var showSoundsWrong = new InputWrong(
			$("#showsounds_inpnt"),
			$("#showsounds_msg"),
			$("#show_sounds")
		);
		showSoundsWrong.bindEvent();
		//手机预警
		var showIphone = new InputWrong(
			$("#iphone_input"),
			$("#iphone_msg"),
			$("#keep_iphone")
		);
		showIphone.bindEvent();
	},
	renderList : async function(data, stock){
		var thsQuote = new ThsQuote();
		var decimalLen = await thsQuote.GetCodeDecimal({stock:stock});
		var stockjj = stock.substring(0,6);
		var newJia = data['NEW'];
		if(newJia != 'NaN'){
			if(decimalLen == 0){
				var dataNew = parseFloat(data['NEW']).toFixed(0);
				var pres = parseFloat(data['PRE']).toFixed(0);
			}else if(decimalLen == 1){
				var dataNew = parseFloat(data['NEW']).toFixed(1);
				var pres = parseFloat(data['PRE']).toFixed(1);
			}else if(decimalLen == 2){
				var dataNew = parseFloat(data['NEW']).toFixed(2);
				var pres = parseFloat(data['PRE']).toFixed(2);
			}else if(decimalLen == 3){
				var dataNew = parseFloat(data['NEW']).toFixed(3);
				var pres = parseFloat(data['PRE']).toFixed(3);
			}else if(decimalLen == 4){
				var dataNew = parseFloat(data['NEW']).toFixed(4);
				var pres = parseFloat(data['PRE']).toFixed(4);
			}else if(decimalLen == 5){
				var dataNew = parseFloat(data['NEW']).toFixed(5);
				var pres = parseFloat(data['PRE']).toFixed(5);
			}else{
				var dataNew = parseFloat(data['NEW']).toFixed(2);
				var pres = parseFloat(data['PRE']).toFixed(2);
			}
			$("#newP").html(dataNew);
			$("#newP").attr('pres',pres);
			//上涨到
			$(".view_price_up_input").attr('view_less_value', dataNew);
			$(".view_price_up_input").attr('view_max_value', dataNew);
			//下跌到
			$(".view_price_down_input").attr('view_less_value', dataNew);
			$(".view_price_down_input").attr('view_max_value', dataNew);
		}
	},
	render : async function (data, stock, mStock) {
		var market = mStock.split(':')[1];
		var thsQuote = new ThsQuote();
		var decimalLen = await thsQuote.GetCodeDecimal({stock:stock});
		var stockjj = $("#view_stock_input").val().substring(0, 6);
		var stockn = $("#view_stock_input").val();
		var newJia = data['NEW'];
		var dataZhangdiefu = parseFloat(data['ZHANGDIEFU']).toFixed(2);
		var dataZhangshu = parseFloat(data['3934664']).toFixed(2);
		var dataHuanshou = parseFloat(data['HUANSHOU']).toFixed(2);


		//新股票选中都去掉
		if($(".view_i_select").hasClass('c-on') || $('.c-wrong').html() != ''){
			$(".view_i_select").removeClass('c-on');
			$(".c-wrong").html('');
		}

		if(stockn.length <= 7 ){
			$("#view_stock_input").val($("#view_stock_input").val()+' '+data['ZQMC']);
		}
		//港股stockjj.indexOf('HK') >= 0
		//基金1 or 5开头
		if(newJia == 'NaN' || newJia == '--'){
			$("#view_stock_curprice").html('--');
			$("#view_price_up_input").val('--');
			$("#view_price_down_input").val('--');
			$("#view_stock_zhangdiefu").html('--');
			$("#view_day_zhangfu_input").val("--");
			$("#view_day_diefu_input").val('--');
			$("#view_fivemin_zhangfu_input").val('--');
			$("#view_fivemin_diefu_input").val('--');
			$("#view_huanshoulv_input").val('--');
			/*$("#view_huanshoulv_input").val('--');
			$("#view_one_chengjiaoliang_input").val('--');*/
		}else{
			//涨跌幅
			if(dataZhangdiefu < 0){
				$("#view_stock_zhangdiefu").html(parseFloat(-dataZhangdiefu).toFixed(2)+"%");
			}else{
				$("#view_stock_zhangdiefu").html(dataZhangdiefu+"%");
			}
			if(decimalLen == 0){
				var dataNew = parseFloat(data['NEW']).toFixed(0);
				var highs = parseFloat(data['HIGH']).toFixed(0);
				var lows = parseFloat(data['LOW']).toFixed(0);
				var pres = parseFloat(data['PRE']).toFixed(0);
				//昨收
				$("#view_stock_curprice").attr('pres',pres);
				//现价
				$("#view_stock_curprice").html(dataNew);
				//上涨到
				$("#view_price_up_input").val(parseFloat(parseFloat(dataNew)+1).toFixed(0));
				//下跌到
				$("#view_price_down_input").val(parseFloat(parseFloat(dataNew)-1).toFixed(0));
			}else if(decimalLen == 1){
				var dataNew = parseFloat(data['NEW']).toFixed(1);
				var highs = parseFloat(data['HIGH']).toFixed(1);
				var lows = parseFloat(data['LOW']).toFixed(1);
				var pres = parseFloat(data['PRE']).toFixed(1);
				//昨收
				$("#view_stock_curprice").attr('pres',pres);
				//现价
				$("#view_stock_curprice").html(dataNew);
				//上涨到
				$("#view_price_up_input").val(parseFloat(parseFloat(dataNew)+0.1).toFixed(1));
				//下跌到
				$("#view_price_down_input").val(parseFloat(parseFloat(dataNew)-0.1).toFixed(1));
			}else if(decimalLen == 2){
				var dataNew = parseFloat(data['NEW']).toFixed(2);
				var highs = parseFloat(data['HIGH']).toFixed(2);
				var lows = parseFloat(data['LOW']).toFixed(2);
				var pres = parseFloat(data['PRE']).toFixed(2);
				//昨收
				$("#view_stock_curprice").attr('pres',pres);
				//现价
				$("#view_stock_curprice").html(dataNew);
				//上涨到
				$("#view_price_up_input").val(parseFloat(parseFloat(dataNew)+0.01).toFixed(2));
				//下跌到
				$("#view_price_down_input").val(parseFloat(parseFloat(dataNew)-0.01).toFixed(2));
			}else if(decimalLen == 3){
				var dataNew = parseFloat(data['NEW']).toFixed(3);
				var highs = parseFloat(data['HIGH']).toFixed(3);
				var lows = parseFloat(data['LOW']).toFixed(3);
				var pres = parseFloat(data['PRE']).toFixed(3);
				//昨收
				$("#view_stock_curprice").attr('pres',pres);
				//现价
				$("#view_stock_curprice").html(dataNew);
				//上涨到
				$("#view_price_up_input").val(parseFloat(parseFloat(dataNew)+0.001).toFixed(3));
				//下跌到
				$("#view_price_down_input").val(parseFloat(parseFloat(dataNew)-0.001).toFixed(3));

			}else if(decimalLen == 4){
				var dataNew = parseFloat(data['NEW']).toFixed(4);
				var highs = parseFloat(data['HIGH']).toFixed(4);
				var lows = parseFloat(data['LOW']).toFixed(4);
				var pres = parseFloat(data['PRE']).toFixed(4);
				//昨收
				$("#view_stock_curprice").attr('pres',pres);
				//现价
				$("#view_stock_curprice").html(dataNew);
				//上涨到
				$("#view_price_up_input").val(parseFloat(parseFloat(dataNew)+0.0001).toFixed(4));
				//下跌到
				$("#view_price_down_input").val(parseFloat(parseFloat(dataNew)-0.0001).toFixed(4));

			}else if(decimalLen == 5){
				var dataNew = parseFloat(data['NEW']).toFixed(5);
				var highs = parseFloat(data['HIGH']).toFixed(5);
				var lows = parseFloat(data['LOW']).toFixed(5);
				var pres = parseFloat(data['PRE']).toFixed(5);
				//昨收
				$("#view_stock_curprice").attr('pres',pres);
				//现价
				$("#view_stock_curprice").html(dataNew);
				//上涨到
				$("#view_price_up_input").val(parseFloat(parseFloat(dataNew)+0.00001).toFixed(5));
				//下跌到
				$("#view_price_down_input").val(parseFloat(parseFloat(dataNew)-0.00001).toFixed(5));

			}else{
				var dataNew = parseFloat(data['NEW']).toFixed(2);
				var highs = parseFloat(data['HIGH']).toFixed(2);
				var lows = parseFloat(data['LOW']).toFixed(2);
				var pres = parseFloat(data['PRE']).toFixed(2);
				//昨收
				$("#view_stock_curprice").attr('pres',pres);
				//现价
				$("#view_stock_curprice").html(dataNew);
				//上涨到
				$("#view_price_up_input").val(parseFloat(parseFloat(dataNew)+0.01).toFixed(2));
				//下跌到
				$("#view_price_down_input").val(parseFloat(parseFloat(dataNew)-0.01).toFixed(2));

			}

			//现价，如果涨跌幅  >0红色 =0黑色 <0绿色
			//涨跌幅

			if (dataZhangdiefu < 0) {
				$("#view_stock_curprice").removeClass('c-red').removeClass('c-block').addClass('c-green');
				$("#view_stock_zhangdiefu").removeClass('c-red').removeClass('c-block').addClass('c-green');
			} else if (dataZhangdiefu > 0) {
				$("#view_stock_curprice").removeClass('c-green').removeClass('c-block').addClass('c-red');
				$("#view_stock_zhangdiefu").removeClass('c-green').removeClass('c-block').addClass('c-red');
			} else {
				$("#view_stock_curprice").removeClass('c-red').removeClass('c-green').addClass('c-block');
				$("#view_stock_zhangdiefu").removeClass('c-red').removeClass('c-green').addClass('c-block');
			}

			//上涨到
			$("#view_price_up_input").attr('view_less_value', dataNew);
			$("#view_price_up_input").attr('view_max_value', dataNew);
			//下跌到
			$("#view_price_down_input").attr('view_less_value', dataNew);
			$("#view_price_down_input").attr('view_max_value', dataNew);

			//日涨跌幅
			var zhangfuK = parseFloat(pres - highs);
			var diefuK = parseFloat(lows - pres);
			var fuduK1 =  parseFloat(pres - lows);
			var fuduK2 =  parseFloat(highs - pres);
			if(highs == 'NaN' && lows == 'NaN'){
				$("#view_day_zhangfu_input").val("0.01");
				$("#view_day_diefu_input").val("0.01");
			}else{
				if(zhangfuK >= 0 ){
					$("#view_day_zhangfu_input").val("0.01");
					var lowZ = parseFloat(parseFloat(((lows-pres)/pres)*100) - 0.01).toFixed(2);
					$("#view_day_diefu_input").val(parseFloat(-lowZ));
				}
				if(diefuK >= 0){
					$("#view_day_diefu_input").val("0.01");
					var highZ = parseFloat(parseFloat(((highs-pres)/pres)*100) + 0.01).toFixed(2);
					$("#view_day_zhangfu_input").val(highZ);
				}
				if(fuduK1 > 0 && fuduK2 > 0){
					var highZ = parseFloat(parseFloat(((highs-pres)/pres)*100) + 0.01).toFixed(2);
					var lowZ = parseFloat(parseFloat(((lows-pres)/pres)*100) - 0.01).toFixed(2);
					$("#view_day_zhangfu_input").val(highZ);
					$("#view_day_diefu_input").val(parseFloat(-lowZ));
				}
			}
			//5分钟涨跌幅
			if(dataZhangshu == 'NaN'){
				$("#view_fivemin_zhangfu_input").val('--');
				$("#view_fivemin_diefu_input").val('--');
			}else{
				//COCO修改，将5分钟涨跌幅默认预警值改成1.00
				if(dataZhangshu > 0 ){
		        	$("#view_fivemin_zhangfu_input").val((parseFloat(dataZhangshu) + 1).toFixed(2));
		        	$("#view_fivemin_diefu_input").val('1.00');
				}else{
					$("#view_fivemin_diefu_input").val((parseFloat(-(dataZhangshu)) + 1).toFixed(2));
					$("#view_fivemin_zhangfu_input").val('1.00')
				}
			}
			//换手率和成交量
			if(dataHuanshou == 'NaN'){
				$("#view_huanshoulv_input").val('--');
				// $("#view_one_chengjiaoliang_input").val('--');
			}else{
				//换手率
		        // $("#view_huanshoulv_input").val((parseFloat(dataHuanshou) + 0.01).toFixed(2));
		        var clientInterface = new ComClientInterface();
		        var num = await clientInterface.getFileContent('ths_subscribe_coco\\huanshoulv.ini');
		        if(num === false){
		        	$("#view_huanshoulv_input").val('5');	
		        }else{
		        	$("#view_huanshoulv_input").val(num);	
		        }
		        
				//单笔成交量
				// $("#view_one_chengjiaoliang_input").val(1);
			}

		}


		//日涨跌幅
		/*if(dataZhangdiefu > 0 ){
        	$("#view_day_zhangdiefu_input").val((parseFloat(dataZhangdiefu) + 0.01).toFixed(2));
		}else{
			$("#view_day_zhangdiefu_input").val((parseFloat(-(dataZhangdiefu)) + 0.01).toFixed(2));
		}*/






		//当前选择股票
		$("#hiddenNowStock").val(stock);
	}
}